package com.temp.check;

import com.temp.check.base.DBColumnVO;
import com.temp.check.base.DBCond;
import com.temp.check.base.DBConfig;
import com.temp.check.base.DBUtil;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * 博瑞达修改仓库，库区编码
 */
public class BrdNameChangeAction {

    public static void main(String[] args) {
        try {
            DBConfig config = DBUtil.getConfig("36.135.17.253:28995", "root", "QP*imsp666*8");


            //1
            DBCond cond1 = new DBCond().setDbLike("dongz_").setColumnLikes("specification","material_name","material_no");
            printSql(DBUtil.queryColumn(config, cond1));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }


    private static void printSql(List<DBColumnVO> dataColumnVOS) {
        StringBuilder upt = new StringBuilder();
        for (DBColumnVO d : dataColumnVOS) {
            upt.append("\n");
            upt.append(" ALTER TABLE ").append(d.getDbName()).append(".").append(d.getTableName());
            upt.append(" MODIY COLUMN ").append(d.getColumnName()).append(" VARCHAR(500)");
            upt.append("; ");
        }

        upt.append("\n");
        System.out.println(upt.toString());
    }

}